how can prevent the empty input in jquery

80

how can prevent the empty input in jquery -

$('#form').submit(function() {
    if ($.trim($("#email").val()) === "" || $.trim($("#user_name").val()) === "") {
        alert('you did not fill out one of the fields');
        return false;
    }
});

Comments

Submit
0 Comments